package com.tsj.mvp.demo2;

import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.tsj.mvp.R;

/**
 * 开始封装
 * 不足，当Activity销毁的时候，或者在后台时，activity还持有LoginPresenter引用，demmo3开始优化loginPresenter
 * */
public class MainActivity2 extends AppCompatActivity implements LoginView{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void onClickView(View view){
        LoginPresenter loginPresenter = new LoginPresenter(this);
        loginPresenter.login("123456","123456");
    }

    @Override
    public void onLoginResult(String result) {
        Toast.makeText(this,result,Toast.LENGTH_LONG).show();
    }
}